package com.yanceysong.common.util;

import com.yanceysong.common.ListNode;

public class NodePrintUtil {

    public static void printListNodeWithDescription(ListNode node, String description) {
        System.out.print(description + ": ");
        ListNode current = node;
        while (current != null) {
            System.out.print(current.val);
            if (current.next != null) {
                System.out.print(" -> ");
            }
            current = current.next;
        }
        System.out.println(" -> null");
    }
}